home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / T-Z / Windoids.cpt / Windoid 1.7 / card_2063.txt < prev    next >
Text File  |  1989-04-19  |  15KB  |  402 lines

  1. -- card: 2063 from stack: in.7
  2. -- bmap block id: 2328
  3. -- flags: 0000
  4. -- background id: 10029
  5. -- name: 
  6. ----- HyperTalk script -----
  7. -- ShowMe
  8. -- THIS VERSION FOR WINDOID DEMO PURPOSES ONLY.
  9. -- DO NOT PASTE IT INTO YOUR HOME STACK.
  10.  
  11. -- ShowMe makes a list of all the objects of the current
  12. -- card and background and puts them in a card field named
  13. -- "objects list". Copy this script into your Home stack,
  14. -- then you can type "showme" into the message box while
  15. -- you're looking at any card.
  16. on showMe
  17.   set cursor to 4 -- wristwatch or set cursor to watch in 1.2.1.
  18.   --  "objectNames" will be the variable we'll load up to contain
  19.   -- the names of the objects on the card.
  20.   -- First, the title:
  21.   put "Objects of " & the name of this card & return & return into objectNames
  22.  
  23.   -- BACKGROUND FIELDS
  24.  
  25.   -- Then, we get the field names (if any).
  26.   if the number of fields <> 0 then
  27.     repeat with i = 1 to the number of fields
  28.       -- in order to tell whether a field is hidden or not, we‚Äôll
  29.       -- use a variable called "showing". We'll begin by making it
  30.       -- empty.
  31.       put empty into showing
  32.       -- Now, for each field, we're putting either nothing or "hidden"
  33.       -- into "showing".
  34.       if not the visible of field i then put "[hidden]" into showing
  35.       -- The construction "not the visible of field i" resolves to
  36.       -- either true or false depending whether the field is hidden
  37.       -- or visible.
  38.       -- Now we add the field name, whether it is visible or not, and a
  39.       -- return to our variable "objectNames".
  40.       put the name of field i && showing & return after objectNames
  41.     end repeat
  42.   end if
  43.   -- Here, we're going to write a "graphic" element to indicate the
  44.   -- end of the list of fields.
  45.   put "=====" & return after objectNames
  46.  
  47.   -- BACKGROUND BUTTONS
  48.  
  49.   -- Using the same routine we did for the background fields:
  50.   if the number of background buttons <> 0 then
  51.     repeat with i = 1 to the number of bkgnd buttons
  52.       put empty into showing
  53.       if not the visible of background button i then put "[hidden]" into showing
  54.       put the name of background button i && showing & return after objectNames
  55.     end repeat
  56.   end if
  57.   -- again, this is the graphic element that indicates the end
  58.   -- of the list of background buttons.
  59.   put "=====" & return after objectNames
  60.  
  61.   -- CARD FIELDS
  62.  
  63.   if the number of card fields <> 0 then
  64.     repeat with i = 1 to the number of card fields
  65.       put empty into showing
  66.       if not the visible of card field i then put "[hidden]" into showing
  67.       put the name of card field i && showing & return after objectNames
  68.     end repeat
  69.   end if
  70.   put "=====" & return after objectNames
  71.  
  72.   -- CARD BUTTONS
  73.  
  74.   if the number of buttons <> 0 then
  75.     repeat with i = 1 to the number of buttons
  76.       put empty into showing
  77.       if not the visible of button i then put "[hidden]" into showing
  78.       put the name of button i && showing & return after OBJECTNAMES
  79.     end repeat
  80.   end if
  81.  
  82.   -- PUTTING THE LIST INTO A CARD FIELD
  83.  
  84.   -- Okay, we've got the entire list of objects. Now, we
  85.   -- check the list to see if it already contains a card field
  86.   -- named "object list". If it does, then we put our list into
  87.   -- that field and we're done.  If it does not, then we make
  88.   -- the new card field on the fly and put our list into it.
  89.  
  90.   if OBJECTNAMES contains "object list" then
  91.     put OBJECTNAMES & return & return into card field "object list"
  92.     show card field "object list"
  93.     exit showMe
  94.   end if
  95.  
  96.   -- MAKING A NEW CARD FIELD
  97.  
  98.   doMenu "new field"   -- makes a new card field
  99.   -- Since new cards are unnamed (unlike buttons, which get the
  100.   -- name "new button"), we'll refer to the field by number. If
  101.   -- we already had, for example, three card fields on the card,
  102.   -- our new field will be number 4. Rather than keep track of
  103.   -- how many card fields we have on this card, we simply refer
  104.   -- to the function, number of, knowing that the number of
  105.   -- card fields has been increased by one. We could write:
  106.   -- get the number of card fields
  107.   -- then use that number to refer to our new field. But,
  108.   -- more directly, we simply put "the number of card fields"
  109.   -- in parentheses where we want HyperCard to count the card
  110.   -- fields, and we end up with:
  111.   set name of card field (the number of card fields) to "object list"
  112.   -- Now that we have a name for our new card field, we can refer
  113.   -- to it by its name. Next step is to tell HyperCard
  114.   -- what the properties of the field should be.
  115.   set rect of card field "object list" to 0,0,258,342
  116.   set style of card field "object list" to scrolling
  117.   set textfont of card field "object list" to geneva
  118.   set textsize of card field "object list" to 9
  119.   -- Now we put our variable into the field.
  120.   put OBJECTNAMES into card field "object list"
  121.   -- The field that we‚Äôve drawn on the card is pretty big. It
  122.   -- stretches from the upper left corner to about 1/3 of
  123.   -- the way across the card at the bottom. If we want to see
  124.   -- what's underneath the scrolling field, we have to hide
  125.   -- the field. So, we put a handler in the field‚Äôs script
  126.   -- that lets us do that. This handler hides "the target"
  127.   -- (the object that got the mouseUp message) and also
  128.   -- puts a command into the message box, ready for us to
  129.   -- type a return. That command shows the hidden field again.
  130.   put "on mouseUp" & return & "choose field tool" & return & "select me" & return & "doMenu" && quote & "Clear Field" & quote & return & "choose browse tool" & return & "end mouseUp" & return into temp
  131.   -- I put the script into the variable "temp" first,
  132.   -- so the next line of HyperTalk code will be simple
  133.   -- and straightforward.
  134.   set script of card field "object list" to temp
  135.   -- Now we lock the field so we can click on it.
  136.   set locktext of card field "object list" to true
  137.   -- And we‚Äôre all done, so let‚Äôs get back to our browsing.
  138.   choose browse tool
  139. end showMe
  140.  
  141. on closeCard
  142.   get the number of cd flds
  143.   if it = 3 then
  144.     lock screen
  145.     choose field tool
  146.     select cd fld 3
  147.     doMenu "Clear Field"
  148.     choose browse tool
  149.     unlock screen
  150.   end if
  151. end closeCard
  152.  
  153.  
  154.  
  155.  
  156. -- part 1 (button)
  157. -- low flags: 00
  158. -- high flags: 0000
  159. -- rect: left=76 top=211 right=242 bottom=107
  160. -- title width / last selected line: 0
  161. -- icon id / first selected line: 31761 / 31761
  162. -- text alignment: 1
  163. -- font id: 0
  164. -- text size: 12
  165. -- style flags: 0
  166. -- line height: 16
  167. -- part name: 
  168. ----- HyperTalk script -----
  169. on mouseUp
  170.   set the hilight of me to not the hilight of me
  171.   set the visible of cd fld 2 to not the visible of cd fld 2
  172. end mouseUp
  173.  
  174.  
  175.  
  176. -- part 2 (field)
  177. -- low flags: 01
  178. -- high flags: 0000
  179. -- rect: left=6 top=214 right=239 bottom=77
  180. -- title width / last selected line: 0
  181. -- icon id / first selected line: 0 / 0
  182. -- text alignment: 65535
  183. -- font id: 20
  184. -- text size: 12
  185. -- style flags: 8192
  186. -- line height: 12
  187. -- part name: 
  188. ----- HyperTalk script -----
  189. on mouseUp
  190.   send mouseUp to cd btn 1
  191. end mouseUp
  192.  
  193.  
  194.  
  195. -- part 3 (field)
  196. -- low flags: 81
  197. -- high flags: 2007
  198. -- rect: left=114 top=208 right=319 bottom=296
  199. -- title width / last selected line: 0
  200. -- icon id / first selected line: 0 / 0
  201. -- text alignment: 0
  202. -- font id: 20
  203. -- text size: 12
  204. -- style flags: 0
  205. -- line height: 13
  206. -- part name: 
  207. ----- HyperTalk script -----
  208. on mouseUp
  209.   send mouseUp to cd btn 1
  210. end mouseUp
  211.  
  212.  
  213.  
  214. -- part contents for background part 11
  215. ----- text -----
  216. ‚Ä¢ I recently had the pleasure of developing a set of 19 stacks for a client. These stacks were moderately complex, including a context-sensitive help system using hidden fields and buttons. It was easy to lose track of which objects we'd already put on the cards, so I wrote this script to add to the handlers in my Home stack script. Now I can simply type 
  217. "showMe" into the message box in any stack, and HyperCard will come back with a list of all the objects (including hidden objects) on the card I'm looking at and put the list into a card field that the script draws for that purpose.
  218.  
  219. Editor's Note: Option-Return looks like this: ¬¨
  220. __________________________________________________________
  221.  
  222. -- ShowMe
  223. -- 3/24/88 version 0.4
  224.  
  225. -- ShowMe makes a list of all the objects of the current
  226. -- card and background and puts them in a card field named
  227. -- "objects list". Copy this script into your Home stack,
  228. -- then you can type "showme" into the message box while
  229. -- you're looking at any card.
  230. on showMe
  231.   set cursor to 4 -- wristwatch or set cursor to watch in 1.2.1.
  232.   --  "objectNames" will be the variable we'll load up to contain
  233.   -- the names of the objects on the card.
  234.   -- First, the title:
  235.   put "Objects of " & the name of this card & return & return ¬¨
  236.   into objectNames
  237.   
  238.   -- BACKGROUND FIELDS
  239.   
  240.   -- Then, we get the field names (if any).
  241.   if the number of fields <> 0 then
  242.     repeat with i = 1 to the number of fields
  243.       -- in order to tell whether a field is hidden or not, we‚Äôll
  244.       -- use a variable called "showing". We'll begin by making it
  245.       -- empty.
  246.       put empty into showing
  247.       -- Now, for each field, we're putting either nothing or "hidden"
  248.       -- into "showing".
  249.       if not the visible of field i then put "[hidden]" into showing
  250.       -- The construction "not the visible of field i" resolves to
  251.       -- either true or false depending whether the field is hidden
  252.       -- or visible.
  253.       -- Now we add the field name, whether it is visible or not, and a
  254.       -- return to our variable "objectNames".
  255.       put the name of field i && showing & return after objectNames
  256.     end repeat
  257.   end if
  258.   -- Here, we're going to write a "graphic" element to indicate the
  259.   -- end of the list of fields.
  260.   put "=====" & return after objectNames
  261.   
  262.   -- BACKGROUND BUTTONS
  263.   
  264.   -- Using the same routine we did for the background fields:
  265.   if the number of background buttons <> 0 then
  266.     repeat with i = 1 to the number of bkgnd buttons
  267.       put empty into showing
  268.       if not the visible of background button i then ¬¨
  269.       put "[hidden]" into showing
  270.       put the name of background button i && ¬¨
  271.       showing & return after objectNames
  272.     end repeat
  273.   end if
  274.   -- again, this is the graphic element that indicates the end
  275.   -- of the list of background buttons.
  276.   put "=====" & return after objectNames
  277.   
  278.   -- CARD FIELDS
  279.   
  280.   if the number of card fields <> 0 then
  281.     repeat with i = 1 to the number of card fields
  282.       put empty into showing
  283.       if not the visible of card field i then ¬¨
  284.       put "[hidden]" into showing
  285.       put the name of card field i && showing & return ¬¨
  286.       after objectNames
  287.     end repeat
  288.   end if
  289.   put "=====" & return after objectNames
  290.   
  291.   -- CARD BUTTONS
  292.   
  293.   if the number of buttons <> 0 then
  294.     repeat with i = 1 to the number of buttons
  295.       put empty into showing
  296.       if not the visible of button i then ¬¨
  297.       put "[hidden]" into showing
  298.       put the name of button i && showing & ¬¨
  299.       return after OBJECTNAMES
  300.     end repeat
  301.   end if
  302.   
  303.   -- PUTTING THE LIST INTO A CARD FIELD
  304.   
  305.   -- Okay, we've got the entire list of objects. Now, we
  306.   -- check the list to see if it already contains a card field
  307.   -- named "object list". If it does, then we put our list into
  308.   -- that field and we're done.  If it does not, then we make
  309.   -- the new card field on the fly and put our list into it.
  310.   
  311.   if OBJECTNAMES contains "object list" then
  312.     put OBJECTNAMES & return & return into card field "object list"
  313.     show card field "object list"
  314.     exit showMe
  315.   end if
  316.   
  317.   -- MAKING A NEW CARD FIELD
  318.   
  319.   doMenu "new field"   -- makes a new card field
  320.   -- Since new cards are unnamed (unlike buttons, which get the
  321.   -- name "new button"), we'll refer to the field by number. If
  322.   -- we already had, for example, three card fields on the card,
  323.   -- our new field will be number 4. Rather than keep track of
  324.   -- how many card fields we have on this card, we simply refer
  325.   -- to the function, number of, knowing that the number of
  326.   -- card fields has been increased by one. We could write:
  327.   -- get the number of card fields
  328.   -- then use that number to refer to our new field. But,
  329.   -- more directly, we simply put "the number of card fields"
  330.   -- in parentheses where we want HyperCard to count the card
  331.   -- fields, and we end up with:
  332.   set name of card field (the number of card fields) to "object list"
  333.   -- Now that we have a name for our new card field, we can refer
  334.   -- to it by its name. Next step is to tell HyperCard
  335.   -- what the properties of the field should be.
  336.   set rect of card field "object list" to 0,0,258,342
  337.   set style of card field "object list" to scrolling
  338.   set textfont of card field "object list" to geneva
  339.   set textsize of card field "object list" to 9
  340.   -- Now we put our variable into the field.
  341.   put OBJECTNAMES into card field "object list"
  342.   -- The field that we‚Äôve drawn on the card is pretty big. It
  343.   -- stretches from the upper left corner to about 1/3 of
  344.   -- the way across the card at the bottom. If we want to see
  345.   -- what's underneath the scrolling field, we have to hide
  346.   -- the field. So, we put a handler in the field‚Äôs script
  347.   -- that lets us do that. This handler hides "the target"
  348.   -- (the object that got the mouseUp message) and also
  349.   -- puts a command into the message box, ready for us to
  350.   -- type a return. That command shows the hidden field again.
  351.   put "on mouseUp" & return &¬¨
  352.   "hide the target" & return &¬¨
  353.   "put" && quote & "show" & quote && " && the name of the target" ¬¨
  354.   & return & "end mouseUp" & return into temp
  355.   -- I put the script into the variable "temp" first,
  356.   -- so the next line of HyperTalk code will be simple
  357.   -- and straightforward.
  358.   set script of card field "object list" to temp
  359.   -- Now we lock the field so we can click on it.
  360.   set locktext of card field "object list" to true
  361.   -- And we‚Äôre all done, so let‚Äôs get back to our browsing.
  362.   choose browse tool
  363. end showMe
  364. Ô£ø
  365.  
  366. -- part contents for background part 17
  367. ----- text -----
  368. ShowMe:
  369.  a Home Stack Script
  370.  
  371. -- part contents for background part 18
  372. ----- text -----
  373.  
  374.  
  375.  
  376. ‚Ä¢ by
  377. Paul Foraker
  378.  
  379.  
  380. -- part contents for card part 2
  381. ----- text -----
  382. how to try
  383. ShowMe
  384.  
  385. -- part contents for card part 3
  386. ----- text -----
  387.  
  388. about SHOWME
  389. ‚Ä¢ WINDOID stack design note
  390. _________________________
  391.  
  392. ‚Ä¢ You can test the script by typing "showMe" into the message box while on this card.
  393.  
  394. ‚Ä¢ The ShowMe demo's "objects" field will be deleted when you click it with the mouse, or if you leave this card (a normal ShowMe field will just hide itself if you click it).  This resets the demo so you can try it again and again until you get really bored.
  395.  
  396. ‚Ä¢ Copy the ShowMe script from the scrolling field above to paste into your Home stack script. 
  397. Don't copy the demo version in this card's script container; it has been slightly modified (to implement the demo's self-deletion characteristic), and doesn't behave quite the way Mr. Foraker intended it to.
  398. Ô£ø
  399.  
  400. -- part contents for background part 19
  401. ----- text -----
  402. volume 1 ‚Ä¢  number  7  ‚Ä¢  card 5  ‚Ä¢